
{layout name="../common/master"/}
<!--<link rel="stylesheet" href="__PUBLIC__/auth/bootstrap.css">-->
<!--<link rel="stylesheet" href="__PUBLIC__/auth/bootstrap-theme.css">-->
<link type="text/css" rel="stylesheet" href="__PUBLIC__/auth/css.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/auth/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/auth/jquery.multiselect2side.css" />
<!--<script type="text/javascript" src="__PUBLIC__/auth/jquery.js"></script>-->
<script type="text/javascript" src="__PUBLIC__/auth/jquery.multiselect2side.js"></script>
<div id="right">
<script type="text/javascript">
    jQuery.browser={};
    (function(){
        jQuery.browser.msie=false;
        jQuery.browser.version=0;
        if(navigator.userAgent.match(/MSIE ([0-9]+)./)){
            jQuery.browser.msie=true;
            jQuery.browser.version=RegExp.$1;
        }})();
</script>

<script type="text/javascript">
    $().ready(function() {
        $('#searchable').multiselect2side({
            selectedPosition: 'right',
            moveOptions: false,
            labelsx: '全部角色',
            labeldx: '已有角色'
        });
        $("#form").submit(function(){
            $.ajax({
                type:"post",
                url:"{:URL('home/Systemmanage/setRoleForUser')}",
                data:$("#form").serialize(),
                dataType:"json",
                error:function(data){
                    alert(data);
                },
                success:function(data){
                       if(data.valid){
                           layer.alert(data.msg, {icon: 6,yes:function(){
                               window.location.href="{:URL('home/Systemmanage/userManage')}";
                           }});
                       }else{
                           layer.alert(data.msg, {icon: 6,yes:function(){
                               location.reload();
                           }});
                       }

//                    window.location.href="/user/usermanage";
                }
            });
            return false;
        });
    });
</script>
    <div class="warp_right">
        <div class="cont_top">
            <p><span style="margin:0 10px;">账号ID：{$user.id}</span><span>姓名：{$user.name}</span></p>
        </div>
        <div class="cont_table" style="width:auto">
            <form id="form" action="javascript:;">
                <table>
                    <tr>
                        <td>
                            <input type="hidden" name="userid" value="{$user.id}"/>
                            <select name="searchable[]" id="searchable" multiple="multiple" >
                                {foreach $role as $k => $v}
                                <option value="{$v.id}" {if isset($v.isSetRole)} selected="selected" {/if}>{$v.name}</option>
                                {/foreach}
                            </select>
                        </td>
                    </tr>
                </table>
                <p>
                    <input type="submit"  class="save"  value="保存" />
                    <a class="date" href="javascript:history.go(-1)" >返回</a>
                </p>
            </form>
        </div>
    </div>
</div>